package cli.menu;

/**
 * BudgetBuoy
 * 
 * Simplify your personal expense management
 * 
 * @team cs2103jan13-w15-3j
 */

//--------------------------------------------------------------

/**
 * ManagePaymentModes Class
 * 
 * Description: -
 * 
 * 
 * @package   cli.menu
 * @author    Lai Yong Quan (A0080909Y)
 * @editor(s) -
 */



class ManagePaymentModes extends Function{
	
	private static final String[] MANAGE = {
		"-= Main menu > Manage Payment Modes =-",
		"[b]: back [u]: undo [r]: redo [h]: home menu",
		"1. Add Payment Mode",
		"2. Rename a Payment Mode",
		"3. Merge Payment Modes",
		"4. Delete a Payment",
		"",
		"Option: "
	};
	
	private static State CURRENT = State.MANAGEPAYMENTMODES;
	private static State BACK = State.MAINMENU;
	
	public static State runMenu(){
		

	String input = null;
	
	while(input == null || input.length() == 0){
		cli.clearScreen();
		cli.print(MANAGE);
		input = cli.nextLine();
	
	}
	
	return processInput(input);
	
	}
	
	private static State processInput(String input){
		
		char charInput = input.charAt(0);
		State nextState = CURRENT;
		switch (charInput) {
		case 'b':
		case 'B':
			nextState = BACK;
			break;
		case 'h':
		case 'H':
			nextState = State.MAINMENU;
			break;
		case 'u':
		case 'U':
			tools.undo();
			break;
		case 'r':
		case 'R':
			tools.redo();
			break;
		case '1':
			nextState = State.ADDPAYMENTMODE;
			break;
		case '2':
			nextState = State.RENAMEPAYMENTMODE;
		break;
		case '3':
			nextState = State.MERGEPAYMENTMODES;
		break;
		case '4':
			nextState = State.DELETEPAYMENTMODE;
		break;
		
		default: {
			cli.println("Invalid input");
			break;
		}

		}

	return nextState;
	
	}
	
}